cmake_minimum_required(VERSION 2.6)

set(HEADERS
	include/WiiCISIO.h
	include/WiiCISIODevice.h
	include/WiiCISIOPrivateInclude.h
	include/WiiCISIOPublicInclude.h
	include/WiiCISIORoot.h
	include/WiiCISIORootWindows.h
	include/WiiCISIOWindows.h
	)

set(SOURCES
	src/WiiCISIODevice.cpp
	src/WiiCISIORoot.cpp
	src/WiiCISIORootWindows.cpp)

if(WIN32)
	set(PLATFORM_LIBS hid setupapi Ws2_32 Bthprops)
	set(WIICIS_PLATFORM windows)
elseif(UNIX)
	set(PLATFORM_LIBS bluetooth pthread)
	set(WIICIS_PLATFORM linux)
else(WIN32)
        message(WARNING "You are using an unsupported platform. WiiCIS IO will not work.")
endif(WIN32)

include_directories (include)

add_library(WiiCISIO SHARED ${HEADERS} ${SOURCES})
set_target_properties(WiiCISIO PROPERTIES RUNTIME_OUTPUT_DIRECTORY .. SOVERSION 1 COMPILE_DEFINITIONS WIICISIO_COMPILE_LIB)
target_link_libraries(WiiCISIO ${PLATFORM_LIBS})

install(TARGETS WiiCISIO
   DESTINATION lib
)

install(FILES ${HEADERS} 
   DESTINATION include/WiiCISIO
)
